package com.superteam.mac.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

import org.springframework.jdbc.core.RowMapper;


import com.superteam.mac.mode.MachineRec;

public class MachineRecDAO extends BaseDAO {

	@SuppressWarnings("unchecked")
	public List<MachineRec> findAll()
	{
		String sql = "select * from tbMachineRec";
		List<MachineRec>  list = this.getJdbcTemplate().query(
			    sql,
			    new RowMapper() {

			        public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
			        	MachineRec machine = new MachineRec();
			        	machine.setWorkshopCode(rs.getString("WorkshopCode"));
			        	machine.setMachineName(rs.getString("MachineName"));
			        	machine.setMachineCode(rs.getString("MachineCode"));
			        	machine.setModelType(rs.getString("ModelType"));
			        	machine.setFlMapX(rs.getInt("FLMapX"));
			        	machine.setFlMapY(rs.getInt("FLMapY"));
			        	machine.setWlMapX(rs.getInt("WLMapX"));
			        	machine.setWlMapY(rs.getInt("WLMapY"));
			        	machine.setDescription(rs.getString("Description"));
			        	
			            return machine;
			        }
			    });
		return list;
	}
	

}
